home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------------------
- // File: AlrtDlogTools.h
- // Date: February 20, 1989
- //
- // By Mike Puckett, Macintosh CPU Software Quality, x4-1332.
- // © 1989 - 1990, Apple Computer, Inc.
- //---------------------------------------------------------------------------------------
- */
- #ifndef __ADTOOLS__
- #define __ADTOOLS__ 1
-
- #ifndef __MAINUTILS__
- #include "MainUtils.h" /* For EvtHndlrProcPtr definition. */
- #endif
-
- #ifndef __WCENTER__
- #include "WCenter.h" /* For CenteringProcPtr definition. */
- #endif
-
- #ifdef THINK_C
- #define cancel Cancel
- #define ok OK
- #endif
-
- /* Useful Definitions ------------------------------------------------------------------
- */
- #define decimalOnly false /* For use with EditNumText(), GetNumEditText(). */
- #define hexDecimal true
-
- #ifndef THINK_C
- typedef pascal Boolean (* ValidTextProcPtr)(DialogPtr theDialog, short theItem);
- #else
- typedef ValidTextProc ProcPtr;
- #endif
-
- #define okayOnly false /* For use with DoXAlert(). */
- #define okayCancel true
-
- #define noAbort true /* For use with SaveChanges(). */
- #define fullClose false
-
- typedef struct /* (Dialog)Item Type. */
- { Handle itemHandle;
- Rect itemRect;
- char itemType,
- data[]; /* data[0] is length of data array. */
- }
- IType,
- *ITPtr;
-
- typedef struct /* (Dialog)Item List. */
- { short numItems;
- IType item[]; /* Array of ITypes. */
- }
- IList,
- *ILPtr,
- **ILHandle;
-
- typedef struct /* For use with Append/RemoveDITL() */
- { DialogTHndl origDLOG,
- addDLOG;
- ILHandle origDITL,
- addDITL;
- }
- ApndInfo,
- *ApndPtr,
- **ApndHandle;
-
- /*
- CloseType is the three-state mechanism used to return a response from the
- standard “Do you want to make changes to xxx?” close dialog box.
-
- Note: These were originally named: yes, abort, no, but abort is defined
- in the StdLib.h file. Oh, well.
- */
- #define closeDlog (short)1908 /* For use with Save[W]Changes(). */
-
- enum
- { closeYes = 1,
- closeCancel,
- closeNo
- };
- typedef short CloseType;
-
- #define alterSCMsgFlag "\pSaveChanges"
- #define alterSCFIndex 0
- #define alterSCMIndex 1
- #define ALTERSCMSG(m) ParamText(alterSCMsgFlag,m,emptyString,emptyString)
-
-
- /*
- The following string is used to HandleOkayCancel that it is dealing with
- SFGetFile, which uses item #3 as the cancel button (bozos!).
-
- This string should be set in the sf1stOpen part of the GetDlgHook routine.
- */
- #define SFGetTitle "\pSFG"
- #define SFPutTitle "\pSFP"
- #define noArrow "\pNoA"
- #define noTextMod "\pNoTM"
-
- /* SFParams is a data structue that encapsulates the two low-memory globals,
- // SFSaveDisk and CurDirStore, which are responsible for displaying SFPutFile
- // and SFGetFile volumes and directories.
- */
- typedef struct /* For use with StdPut/GetDialog(). */
- { short sfSaveDisk; /* This is the vRefNum (not minus). */
- long curDirStore;
- }
- SFParams,
- *SFParamsPtr;
-
- #define creatorRsrc '**ct' /* For use with SFPSelectCreator(). */
- #define sfpPutCreatorID (short)2050 /* These numbers are really in the */
- #define sfpEdtCreaotrID (short)2052 /* LogFile range, oh well. */
-
- #define aboutLibDlogID (short)1877 /* For use with StdLibAboutDlog(). */
-
- #define gnrlStrs (short)1836 /* Various strings. */
- #define gsStop 1
- #define gsContinue 2
-
- #define ptSet "\ptSet" /* ParamText set for DoIndErr(). */
-
- #define gnrlAlert (short)1876 /* For use with DoIndErr/StrAlert() */
-
- #define stopErrs (gnrlAlert+stopIcon)
- #define stopChoosePr 1
-
- #define noteErrs (gnrlAlert+noteIcon)
- #define noteWrongSys (short)1
- #define noteInitErr (short)2
- #define noteNotEnufMem (short)3
- #define noteFSErr (short)4
- #define notePrErr (short)5
-
- #define cautionErrs (gnrlAlert+cautionIcon)
- #define cautionDAMemErr (short)1
- #define cautionDAResErr (short)2
-
- #ifdef __safe_link
- extern "C" {
- #endif
-
- extern pascal void InitAlrtDlogTools( EvtHndlrProcPtr eventHandler);
-
-
- /* Dialog-Item Maninpulation Routines --------------------------------------------------
- */
- extern pascal short GetNumDITLItems( short rsrcID);
-
- extern pascal void GetDITLString( short rsrcID,
- short itemNumber,
- char *theString);
-
- extern pascal void UpdtDItem( DialogPtr theDialog,
- short theItem);
-
- extern pascal void SetDItemTxt( DialogPtr theDialog,
- short theItem,
- char *theText);
- extern pascal void GetDItemTxt( DialogPtr theDialog,
- short theItem,
- char *theText);
-
- extern pascal void SetDItemCtlValue( DialogPtr theDialog,
- short theItem,
- short theValue);
- extern pascal short GetDItemCtlValue( DialogPtr theDialog,
- short theItem);
-
- extern pascal void SetDItemCTitle( DialogPtr theDialog,
- short theItem,
- char *theTitle);
- extern pascal void GetDItemCTitle( DialogPtr theDialog,
- short theItem,
- char *theTitle);
-
- extern pascal ControlHandle GetDItemCtlHandle( DialogPtr theDialog,
- short theItem);
-
- extern pascal unsigned short GetDItemHiliteState( DialogPtr theDialog,
- short theItem);
-
- extern pascal Boolean DoHiliteControl( DialogPtr theDialog,
- short theItem,
- short thePart);
-
- extern pascal void SetControlHilite( DialogPtr theDialog,
- short theItem,
- short theHilite);
-
- extern pascal void HandleRadioButtons( DialogPtr theDialog,
- short startItem,
- short stopItem,
- short setItem);
-
- extern pascal Boolean ToggleCheckBox( DialogPtr theDialog,
- short checkItem,
- Boolean oldValue);
-
- extern pascal void SetupUserItem( DialogPtr theDialog,
- short theItem,
- ProcPtr drawProc);
- extern pascal void SetupUserItems( DialogPtr theDialog,
- short uiStart,
- short uiStop,
- ProcPtr drawProc);
-
- extern pascal void IBeamCursorAdjust( DialogPtr theDialog,
- ValidTextProcPtr validProc);
-
- extern pascal void HandleScrap( DialogPtr theDialog,
- EventRecord *theEvent);
-
- extern pascal void DeleteLeadingPeriods( DialogPtr theDialog,
- short textItem);
-
- extern pascal Boolean HandleOkayCancel( DialogPtr theDialog,
- EventRecord *theEvent,
- short *itemHit);
-
- extern pascal Boolean EditStrText( DialogPtr theDialog,
- EventRecord *theEvent,
- short editItem,
- short maxSizeStr,
- char *excludeChars);
-
- extern pascal Boolean StdValidDecTextProc( DialogPtr theDialog,
- short theItem);
-
-
- extern pascal Boolean EditNumText( DialogPtr theDialog,
- EventRecord *theEvent,
- short editItem,
- long minValue,
- long maxValue,
- Boolean allowHex);
- extern pascal long GetNumEditText( DialogPtr theDialog,
- short editItem,
- Boolean allowHex);
-
- extern pascal void StdDlogActivate( DialogPtr theDialog,
- EventRecord *theEvent);
- extern pascal void StdDlogUpdate( DialogPtr theDialog,
- EventRecord *theEvent);
- extern pascal Boolean StdDlogFilter( DialogPtr theDialog,
- EventRecord *theEvent,
- short *itemHit);
-
- extern pascal ApndHandle AppendDITL( ResType resType,
- short theDialog,
- short addDialog);
- extern pascal void RemoveDITL( ApndHandle apndHandle);
-
- /* Dialogs ---------------------------------------------------------------------------
- */
- extern pascal short DoStrAlert( short alertType,
- short alertID,
- char *str0,
- char *str1,
- char *str2,
- char *str3,
- Boolean showCancel,
- char *okayName,
- char *cancelName);
-
- extern pascal short DoIndErrAlert( short alertType,
- short alertID,
- short messageIndex,
- long errorValue,
- Boolean showCancel);
-
- extern pascal CloseType SaveWChanges( char *wName,
- char *actionType,
- short dlogID,
- Boolean cantAbort);
-
- extern pascal CloseType SaveChanges( char *message,
- Boolean cantAbort,
- CenteringProcPtr centeringProc,
- short constraint);
-
- extern pascal short StdSFPutHook( short theItem,
- DialogPtr theDialog);
- extern pascal void StdSFPutDialog( char *promptStr,
- char *origStr,
- SFReply *sfReply,
- SFParams *sfParams,
- CenteringProcPtr centeringProc,
- short constraint);
-
- extern pascal short StdSFGetHook( short theItem,
- DialogPtr theDialog);
- extern pascal void StdSFGetDialog( short numTypes,
- SFTypeList typeList,
- ProcPtr fileFilter,
- SFReply *sfReply,
- SFParams *sfParams,
- CenteringProcPtr centeringProc,
- short constraint);
-
- extern pascal void SFPSelectCreator( short putCreatorID,
- short otherDlogID,
- ResType *defaultCreator,
- char *promptStr,
- char *origStr,
- SFReply *sfReply,
- SFParams *sfParams);
-
- extern pascal void AddCreator( void);
-
-
- extern pascal void StdLibAboutDlog( char *libName,
- char *versStr,
- short dlogID,
- WindowPtr parentWindow);
-
- #ifdef __safe_link
- }
- #endif
-
- #endif